import type { RouterProps } from 'react-router-dom';
import Task from '@/view/task';
import React from 'react';
import taskinfo from '@/router/taskinfo';
import type { RouteProps, RedirectProps } from 'react-router-dom';
import BasicLayout from '@/layout/basicLayout';
import login from '@/view/login';

interface routes {
  redirect: boolean;
  from: string;
  to: string;
  exact: boolean;
  path: string;
  name: string;
  meta: { [key: string]: string };
  component: RouteProps['component'];
  children: routesType[];
}

export type routesType = Partial<routes>;

const routes: routesType[] = [
  {
    redirect: true,
    from: '/',
    to: '/app',
    exact: true,
  },
  {
    path: '/app',
    name: 'app',
    component: BasicLayout,
    meta: {},
    children: taskinfo,
  },
  {
    path: '/task',
    name: 'task',
    component: Task,
    meta: {},
    children: taskinfo,
  },
  {
    path: '/login',
    name: 'login',
    component: login,
    meta: {},
  },
  {
    redirect: true,
    to: '/app',
  },
];

export default routes;
